#include "OmPublic.h"
#include "OmMutex.h"

namespace OmPublic
{

	// create mutex
	// return true if succeed, else false.
	bool Mutex::create()
	{
		::InitializeCriticalSection(&mObject);
		return true;
	}

	// destroy
	void Mutex::destroy()
	{
		::DeleteCriticalSection(&mObject);
	}

	// lock
	void Mutex::lock()
	{
		::EnterCriticalSection(&mObject);
	}

	// unlock
	void Mutex::unlock()
	{
		::LeaveCriticalSection(&mObject);
	}
}